<%--
  Created by IntelliJ IDEA.
  User: hp
  Date: 2020/7/13
  Time: 2:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="true" %>
<html>
<head>
    <title>入库单</title>
    <%@include file="/common/com.jsp"%>
</head>
<body>
<div id="root">

    <template>
        <Collapse active-key="1">
            <Panel name="Panel">
                多条件查询
                <p slot="content">
                    <i-form :label-width="60" inline>
                        <Form-Item label="商品名字">
                            <i-input type="text" v-model="HousedVo.housedName"></i-input>
                        </Form-Item>
                        <Form-Item label="商品类型">
                            <i-input type="text" v-model="HousedVo.housedType"></i-input>
                        </Form-Item>
                        <Form-Item label="成本价格">
                            <i-input type="text" v-model="HousedVo.housedUnitPrice"></i-input>
                        </Form-Item>
                        <i-button type="primary" shape="circle" icon="ios-search" @click="pageNo=1;gethousedlist();" >搜索</i-button>
                    </i-form>
                </p>
            </Panel>
        </Collapse>

    </template>
    <card>
        <i-button type="primary" shape="circle" @click="gethousedlist()"><Icon type="ios-refresh"></Icon>刷新</i-button>
    </card>

    <i-table :columns="columns" :data="data" border stripe height="400">
        <template slot-scope="{row,index}" slot="action">
            <i-Button type="info" @click="ware(row,index)">取消入库</i-Button>
            <i-Button type="info" @click="library(row,index)">入库</i-Button>
        </template>
    </i-table>
    <Modal v-model="modallibrary" title="入库商品" @on-ok="dolibrary">


        <h3>该商品是否确定入库?</h3>
    </Modal>

    <template>
        <Page :total="total"
              show-elevator
              :page-size="pageSize"
              style="margin-left: 340px;margin-top:15px"
              :current.sync="pageNo"
              show-sizer
              prev-text="上一页"
              next-text="下一页"
              :page-size-opts="[5,10,20,30,40]"
              show-total
              @on-page-size-change="pageSize=arguments[0];gethousedlist();"
              @on-change="gethousedlist"/>
    </template>
</div>
</body>
<script>
    new  Vue({
        el:"#root",
        data:{
            columns:[
                {title: "商品名称", key: "housedName"},
                {title: "订单号", key: "housedId"},
                {title: "数量", key: "housedNumber"},
                {title: "单价", key: "housedUnitPrice"},
                {title: "总价", key: "housedTotalPrice"},
                {title: "入库时间", key: "housedDate"},
                {title:"操作",slot:"action"},

            ],
            data:[],
            modallibrary:false,
            Housed:{},
            HousedVo:{},
            supplierlist:[],
            total:50,
            pageNo:1,
            pageSize:5,
        },
        mounted(){
            this.gethousedlist();
        },
        methods:{
            gethousedlist(){
                axios.get(`${apath}/housed/pagehousedlist/${this.pageSize}/${this.pageNo}`,{params:this.HousedVo})
                    .then(({data})=>{
                        console.log(data.result);
                        this.data=data.result.record;
                        this.total=data.result.total;
                    })
            },

            library(row,index) {

                this.Housed = row;
                this.modallibrary = true;
            },
            dolibrary(){
                axios.post(`${apath}/housed/housedaddRk`,this.Housed)
                    .then(({data})=>{
                        iview.Message.success({content:data.msg})
                        this.gethousedlist();
                    })

            }
        }

    })
</script>
</html>
